<?php

/**
 * Notification form base class.
 *
 * @method Notification getObject() Returns the current form's model object
 *
 * @package    SdCommerce
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseNotificationForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                           => new sfWidgetFormInputHidden(),
      'contenu'                      => new sfWidgetFormInputText(),
      'is_active'                    => new sfWidgetFormInputCheckbox(),
      'is_hidden'                    => new sfWidgetFormInputCheckbox(),
      'is_shown'                     => new sfWidgetFormInputCheckbox(),
      'departement_id'               => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Departement'), 'add_empty' => true)),
      'bon_sortie_id'                => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('BonSortie'), 'add_empty' => true)),
      'bon_entre_id'                 => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('BonEntre'), 'add_empty' => true)),
      'bon_livraison_fournisseur_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('BonLivraisonFournisseur'), 'add_empty' => true)),
      'deleted_at'                   => new sfWidgetFormDateTime(),
      'created_at'                   => new sfWidgetFormDateTime(),
      'updated_at'                   => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                           => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'contenu'                      => new sfValidatorString(array('max_length' => 255)),
      'is_active'                    => new sfValidatorBoolean(array('required' => false)),
      'is_hidden'                    => new sfValidatorBoolean(array('required' => false)),
      'is_shown'                     => new sfValidatorBoolean(array('required' => false)),
      'departement_id'               => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Departement'), 'required' => false)),
      'bon_sortie_id'                => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('BonSortie'), 'required' => false)),
      'bon_entre_id'                 => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('BonEntre'), 'required' => false)),
      'bon_livraison_fournisseur_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('BonLivraisonFournisseur'), 'required' => false)),
      'deleted_at'                   => new sfValidatorDateTime(array('required' => false)),
      'created_at'                   => new sfValidatorDateTime(),
      'updated_at'                   => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('notification[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Notification';
  }

}
